package com.cloud.train.business.controller;

import com.cloud.train.business.req.TrainQueryReq;
import com.cloud.train.business.resp.TrainQueryResp;
import com.cloud.train.business.service.TrainService;
import com.cloud.train.common.resp.CommonResp;
import com.cloud.train.common.resp.PageResp;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/train")
public class TrainController {
    @Resource
    private TrainService trainService;
    @GetMapping("/list")
    public CommonResp<PageResp<TrainQueryResp>> queryList(@Valid TrainQueryReq req){
        PageResp<TrainQueryResp> trainQueryRespPageResp = trainService.queryList(req);
        return new CommonResp<>(trainQueryRespPageResp);
    }
}
